<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue生命周期函数</title>
    <script src="https://unpkg.com/vue@next"></script>
    <!-- 
        <div v-for='(item , index) in listArray':key='index'>
                {{ item }}---{{ index }}
            </div>
        1.测试
        2.使用v-for指令的时候,不遍历对象的一个属性

     -->
</head>
<body>
    <div id="root"></div>
    <script>
        // vue的生命周期函数
        const app = Vue.createApp({
            data() {
                return {
                    listArray: ['tets1','tets2','tets3'],
                    listObject: {
                        firtName: 'dell',
                        lastName: 'lee',
                        job:'teacher'

                    }
                }
            },
            methods: {
                btn(){
                    // 3.更新数组内容
                    // this.listArray[1] ='hellp'
                    // 循环对象内容
                    this.listObject.age=100
                }
            },
            template: `
            <template v-for='(value,key,index) in listObject' > 
                <div v-if="key!== 'lastName'">
                    {{ value }}--->{{key}}    
                </div>
            </template>
            循环数组
            <div v-for='item in 10'>{{item}}</div>
            <button @click='btn'>新增</button>
            `
        });
        const vm = app.mount('#root');
    </script>
</body>
</html>